package com.education.wisdom.service.impl;

import com.education.common.utils.Convert;
import com.education.wisdom.mapper.CouponsMapper;
import com.education.wisdom.pojo.Coupons;
import com.education.wisdom.service.ICouponsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 优惠券 服务层实现
 * 
 * @author ruoyi
 * @date 2019-04-01
 */
@Service
public class CouponsServiceImpl implements ICouponsService
{
	@Autowired
	private CouponsMapper couponsMapper;

	/**
     * 查询优惠券信息
     * 
     * @param id 优惠券ID
     * @return 优惠券信息
     */
    @Override
	public Coupons selectCouponsById(Integer id)
	{
	    return couponsMapper.selectCouponsById(id);
	}
	
	/**
     * 查询优惠券列表
     * 
     * @param coupons 优惠券信息
     * @return 优惠券集合
     */
	@Override
	public List<Coupons> selectCouponsList(Coupons coupons)
	{
	    return couponsMapper.selectCouponsList(coupons);
	}
	
    /**
     * 新增优惠券
     * 
     * @param coupons 优惠券信息
     * @return 结果
     */
	@Override
	public int insertCoupons(Coupons coupons)
	{
	    return couponsMapper.insertCoupons(coupons);
	}
	
	/**
     * 修改优惠券
     * 
     * @param coupons 优惠券信息
     * @return 结果
     */
	@Override
	public int updateCoupons(Coupons coupons)
	{
	    return couponsMapper.updateCoupons(coupons);
	}

	/**
     * 删除优惠券对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deleteCouponsByIds(String ids)
	{
		return couponsMapper.deleteCouponsByIds(Convert.toStrArray(ids));
	}

	@Override
	public List<Coupons> selectCouponsListByUserId(Map<String, Object> map) {
		return couponsMapper.selectCouponsListByUserId(map);
	}
	
}
